package com.kd.controller.recruiter;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.github.pagehelper.PageInfo;
import com.kd.bean.admin.AdminBasic;
import com.kd.bean.jobSeeker.Basic_information;
import com.kd.bean.jobSeeker.My_news;
import com.kd.bean.recruiter.Rec_news;
import com.kd.bean.recruiter.Recruiter_basic;
import com.kd.service.recruiter.IRec_newsService;

@Controller
@RequestMapping("/rec_news")
public class Rec_newsController {

	@Autowired
	private IRec_newsService recNewService;
	
	@RequestMapping("/queryAllRec_news_status")
	@ResponseBody
	public PageInfo<Rec_news> queryAllRec_news_status(Integer pageNum,Integer pageSize,HttpSession session){
		PageInfo<Rec_news> info = null;
		try {
			Recruiter_basic basic = (Recruiter_basic) session.getAttribute("basicMsg");
			info = recNewService.queryAllRec_news_status(pageNum, pageSize, basic.getRecruiter_id());
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return info;
	}
	
	@RequestMapping("/updateRec_news_visit_state")
	@ResponseBody
	public Boolean updateRec_news_visit_state(Integer rec_news_id,Integer rec_news_visit_state) {
		Boolean flag = false;
		try {
			flag = recNewService.updateRec_news_visit_state(rec_news_id, rec_news_visit_state);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return flag;
	}
	
	@RequestMapping("/queryRec_newsBybasic_id")
	@ResponseBody
	public PageInfo<Rec_news> queryRec_newsBybasic_id(Integer pageNum,Integer pageSize,HttpSession session){
		Basic_information basic_information = (Basic_information) session.getAttribute("basicMessage");
		
		PageInfo<Rec_news> info = null;
		try {
			info = recNewService.queryRec_newsBybasic_id(pageNum, pageSize, basic_information.getBasic_id());
			
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return info;
	}
	
}
